import React,{useState} from 'react';
export default function App(){
  const [n,setN] = useState(0);
  const [m,setM] = useState(0);
  
  const add=()=>{
    setN(i=>i+1);
  };
  const addChild=()=>{
    setM(i=>i+1);
  };
  
  return(
    <div>
      <div>
        n:{n}
        <button onClick={add}>n+1</button>
        <button onClick={addChild}>m+1</button>
      </div>
      <Child2 data={m} />
    </div>
  )
}
function Child(props){
  console.log('child执行了')
  return(
    <div>
      child:{props.data}
    </div>
      )
}
const Child2 = React.memo(Child)
